Three.js: DataTexture
データからテクスチャを作っちゃおう
シェーダへのデータの受け渡しによく使う
DataTexture.needsUpdate のセットし忘れによる事故が毎年5000件以上発生しているので気をつけてください
code:js
const texture = new THREE.DataTexture(
data, // typed array, usually Uint8Array
width,
height,
THREE.RedFormat, // THREE.RGBAFormat by default
THREE.FloatType, // THREE.UnsignedByteType by default
);
texture.needsUpdate = true;